package offer;

/**
 * @author SSK
 * 第一个只出现一次的字符
 */
public class T35 {
    public int FirstNotRepeatingChar(String str) {
        int chNum[] = new int[200];
        for (char s: str.toCharArray()) {
            chNum[s]++;
        }
        for (int i = 0; i < str.length(); i++) {
            if (chNum[str.charAt(i)]==1) {
                return i;
            }
        }
        return -1;
    }
    public static void main ( String[] args) {

        System.out.println(new T35().FirstNotRepeatingChar("NXWtnzyoHoBhUJaPauJaAitLWNMlkKwDYbbigdMMaYfkVPhGZcrEwp"));
    }
}
